<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="Been.Admin"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
Admin admin=(Admin)session.getAttribute("admin");
if(null==admin){
	response.sendRedirect("login1.jsp");
}
String msg=(String)request.getAttribute("msg"); 
String TJ=(String)session.getAttribute("msg");
%>

<!DOCTYPE HTML >
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'welcome.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
   <style type="text/css">
   div {
   width:100px;
   height:30px;
   background-color: antiquewhite;
   text-align: center;
   line-height:30px;
   }
   div:hover{
   cursor: pointer;
   background-color: goldenrod;
   color:white;
   }
   
   </style>
  </head>
  
  <body> 
    This is my JSP page. <br>
    <%=session.getAttribute("linestart") %>; 
    <form action="exit.html" method="post">
    <input type="submit"   value="退出"/>
    
    </form>
    <div onmouseover="test()" onmouseout="test2()">
    <span> 查看时间</span>
               
    </div>
    <p id="p"></p>
    <form action="upload.html?type=image" enctype="multipart/form-data" method="post">
      个人图片：<input type="file" name="file"/><br/>
    <input type="submit" value="确定"/>
    </form>
    <a href="build/add.jsp?option=add">添加</a>
    <a href="build/select.jsp">查询</a>
    <a href="build/add.jsp?option=update">修改</a>
    <a href="build/delete.jsp">删除</a>
  <!--  <form action="build.html?option=add" >
    <input type="submit" value="添加">
  
   </form>
   <form action="build.html?option=update">
     <input type="submit" value="修改">
   </form>
   <form action="build.html?option=delete">
     <input type="submit" value="删除">
   </form>
   <form action="build.html?option=select">
     <input type="submit" value="查询">
   </form>-->
   <%session.removeAttribute("msg");%>
   <%request.removeAttribute("msg"); %>
  </body>
  <script type="text/javascript"><!--
  var TJ="<%=TJ%>";
  if(TJ!="null"){
  alert(TJ);
  
  }
  var msg="<%=msg%>";              
  if(msg!="null"){             //一开始用request接收mg的value值，如果不是空则弹出对话框
  alert(msg);
  }
  	 //获取登录时间
  	var start="<%=session.getAttribute("linestart")%>";                
  		var flag;
  	function test(){
  	 flag=	setInterval(getTime,1);
  		//alert(date);
  	}
  	
  	function getTime(){
     	       var now=new Date();
				var x=now-start;       //相差的毫秒数
				var d=parseInt(x/1000/60/60/24);
				var hour=parseInt(x/1000/60/60)-parseInt(x/1000/60/60/24)*24;
				var m=parseInt(x/1000/60)-parseInt(x/1000/60/60)*60;
				var s=parseInt(x/1000)-parseInt(x/1000/60)*60;
				document.getElementById("p").innerHTML=d+"天"+hour+"时"+m+"分"+s+"秒";
  	}
  	function test2(){
  	clearInterval(flag);
  	document.getElementById("p").innerHTML="";
  	
  	}
  --></script>
</html>
